package com.lx.boot.db.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Data
public class BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableField(value="add_user",fill = FieldFill.INSERT)
    @Schema(description =  "添加人", hidden = true)
    private String addUser;

    @TableField(value="add_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description =  "添加时间", hidden = true)
    private Date addTime;

    @TableField(value="update_user", fill = FieldFill.INSERT_UPDATE)
    @Schema(description =  "更新人", hidden = true)
    private String updateUser;

    @TableField(value="update_time",fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description =  "更新时间", hidden = true)
    private Date updateTime;

    @TableLogic(value = "1", delval = "0")
    @TableField(value="is_enabled",fill = FieldFill.INSERT)
    @Schema(description = "是否有效")
    private String isEnabled;

//    @TableLogic
//    @TableField(exist = false)
//    @Schema(description =  "是否删除")
//    private String isDelete;
//
////    @TableField(fill = FieldFill.INSERT)
//    @TableField(exist = false)
//    @Schema(description =  "创建部门ID")
//    private String addDept;
//
//    /**
//     * 搜索值
//     */
//    @JsonIgnore
//    @TableField(exist = false)
//    private String searchValue;
//    /**
//     * 请求参数
//     */
//    @JsonInclude(JsonInclude.Include.NON_EMPTY)
//    @TableField(exist = false)
//    private Map<String, Object> params = new HashMap<>();

}
